import unittest
from Lexer import *
from compiler.ast import Assert

print " --------------------------------- CASOS DE TESTING- ERRORES SEMANTICOS-------------------------------- "
lista = [
         #"Alumnos(1,2,3,4)",
         #"Una_tabla_que_no_existe",
         #"Alumnos(3+4)",
         #"Cursos(id <- Materias)",
         """Cursos(id<"texto")"""#,
         #"",
         #"",
         #"",
         #"",
         #"",
         ]
errores =0
for consulta in lista:
    evalData = None
    a = consulta
    try:
        conBD = yacc.parse(a).compilar()
        print a+ " ----> " + conBD
        print ''
        resConsulta = bdConn.consultarBD(conBD)
        for i in resConsulta:
            print i
    except:
        errores = errores+1
print "Test errores sintacticos, cantidad de pruebas = "+str(len(lista))
print "Cantidad de errores sintacticos detectados = " + str(errores)
print " ------------------------------------------------------------- "
print " ------------------------------------------------------------- "    
print " ------------------------------------------------------------- "